package com.yh.patterns.observer.job;

/**
 * @Author:云尚
 * @Description:具体观察者类
 */
public class Player implements Observer{
    private String name;

    public Player(String name) {
        this.name = name;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public void setName(String name) {
        this.name=name;
    }

    @Override
    public void help() {
        System.out.println("坚持住，"+this.name+"来救你！");
    }

    @Override
    public void attacked(Team team) {
        System.out.println(this.name+"被袭击了");
        team.notify(name);
    }
}
